import java.util.Scanner;
class BankAccount{
    int balance;
    public  BankAccount(){
        this.balance = 0;
    }
    public  BankAccount(int balance){
        this.balance = balance;
    }
    public int getBlance(){
        return this.balance;
    }
    public int withdraw(int amount){
        if(balance >= amount){
            return this.balance = balance - amount;
        }
        public int deposit(int account){
            return this.balance = balance + amount;
        }
        public void print(int balance){
            System.out.println(balance);
        }
    }
    public class Test{
        public static void main(String [] args){
            Scanner sc = new Scanner(System.in);
            int balance = sc.nextInt();
            int opporation = sc.nextInt();
            BankAccount bankaccount = new BankAccount(balance);
            if(opporation == 0){
                System.out.println(balance);
            }else{
                for(int i = 0; i < opporation; i++){
                    int b = sc.nextInt();
                    int money = sc.nextInt();
                    if(b == 1){
                        balance = bankaccount.deposit(money);
                        System.out.println(balance);
                    }else{
                        balance = bankaccount.withdraw(money);
                        System.out.println(balance);
                    }
                }
            }
        }
    }